package com.dfbz.demo01;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo04_gc {
    public static void main(String[] args) {


        for (int i = 0; i < 10; i++) {
            // 使用匿名对象(没有对象保存返回值)
            new Student();
        }
        // 触发垃圾回收器
//        System.gc();

        Runtime runtime = Runtime.getRuntime();
//        runtime.gc();

    }
}

class Student {

    @Override
    protected void finalize() throws Throwable {
        System.out.println("我被回收啦！");
    }
}
